//
//  WKDoubiHeaderView.m
//  WKMaybell
//
//  Created by 何文虎 on 2019/1/3.
//  Copyright © 2019 何文虎. All rights reserved.
//

#import "WKDoubiHeaderView.h"

@interface DBTitleView : UIView
@property(nonatomic,strong)UILabel *titleLb;
@property(nonatomic,strong)UILabel *detailLb;
@end

@implementation DBTitleView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        [self setup];
    }
    return self;
}

- (void)setup{
   
    self.titleLb = [[UILabel alloc]init];
    _titleLb.textColor = UIColorFromHex(0x3C3C3C);
    _titleLb.font = PFSC_BoldFont(15);
    _titleLb.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLb];
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(15);
        make.left.right.with.mas_equalTo(0);
        make.height.mas_equalTo(14);
    }];
    
    self.detailLb = [[UILabel alloc]init];
    _detailLb.textColor = UIColorFromHex(0x3C3C3C);
    _detailLb.font = PFSC_MediumFont(11);
    _detailLb.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.detailLb];
    [self.detailLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLb.mas_bottom).offset(8);
        make.left.right.with.mas_equalTo(0);
        make.height.mas_equalTo(14);
    }];
}

@end

@interface WKDoubiHeaderView ()
@property(nonatomic,strong)UIView *contentView;
@property(nonatomic,strong)UIImageView *bgImgview;
@property(nonatomic,strong)UIImageView *iconImgview;
@property(nonatomic,strong)UILabel *dbLb;


@end

@implementation WKDoubiHeaderView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI{
    
    [self addSubview:self.contentView];
    self.contentView.frame = self.bounds;
    self.contentView.backgroundColor = UIColorFromHex(0xF4F4F4);
    
    [self.contentView addSubview:self.bgImgview];
    [self.bgImgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_offset(0);
        make.height.mas_equalTo(NavBarHeight+123);
    }];
    
    [self.contentView addSubview:self.iconImgview];
    [self.iconImgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(NavBarHeight+16);
        make.size.mas_equalTo(CGSizeMake(60, 60));
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
    }];
    _iconImgview.layer.masksToBounds = YES;
    _iconImgview.layer.cornerRadius = 30;
    
    [self.contentView addSubview:self.dbLb];
    [self.dbLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.iconImgview.mas_bottom).offset(13);
        make.left.mas_equalTo(12);
        make.right.mas_equalTo(-12);
        make.height.mas_equalTo(18);
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
    }];
    
    DBTitleView *qiandaoView = [[DBTitleView alloc]initWithFrame:CGRectMake(0, NavBarHeight+123, ScreenWidth/2, 63)];
    qiandaoView.titleLb.text = @"每日签到";
    qiandaoView.detailLb.text = @"签到得逗币,兑换赢好礼";
    [self.contentView addSubview:qiandaoView];
    
    DBTitleView *xiaofeiView = [[DBTitleView alloc]initWithFrame:CGRectMake(ScreenWidth/2, NavBarHeight+123, ScreenWidth/2, 63)];
    xiaofeiView.titleLb.text = @"消费记录";
    xiaofeiView.detailLb.text = @"记录你的收入与支出";
    [self.contentView addSubview:xiaofeiView];
    
    _bgImgview.backgroundColor = BACK_COLOR;
    _iconImgview.backgroundColor = [UIColor greenColor];
    _dbLb.text = @"540痘币";
}

- (UIView*)contentView{
    if (!_contentView) {
        _contentView = [[UIView alloc]init];
    }
    return _contentView;
}

- (UIImageView*)bgImgview{
    if (!_bgImgview) {
        _bgImgview = [[UIImageView alloc]init];
    }
    return _bgImgview;
}

- (UIImageView*)iconImgview{
    if (!_iconImgview) {
        _iconImgview = [[UIImageView alloc]init];
    }
    return _iconImgview;
}

- (UILabel*)dbLb{
    if (!_dbLb) {
        _dbLb = [[UILabel alloc]init];
        _dbLb.textColor = [UIColor whiteColor];
        _dbLb.textAlignment = NSTextAlignmentCenter;
        _dbLb.font = PFSC_BoldFont(19);
    }
    return _dbLb;
}



@end
